Skip to content

Add option to suppress tool input deltas#1896

Draft
craze3 wants to merge 1 commit intovercel:mainfrom
craze3:codex/suppress-tool-input-deltas
Draft

Add option to suppress tool input deltas#1896
craze3 wants to merge 1 commit intovercel:mainfrom
craze3:codex/suppress-tool-input-deltas

Conversation

@craze3
Copy link
Copy Markdown
Contributor

@craze3 craze3 commented May 2, 2026

Description

Adds a default-off suppressToolInputDeltas option to DurableAgent.stream().

When enabled, @workflow/ai stops writing incremental tool-input-delta chunks to the UI stream, while still preserving:

  • raw model stream processing
  • final parsed tool input via tool-input-available
  • tool execution
  • tool results
  • conversation state used for subsequent steps

This is useful for durable/resumable UI streams where streamed tool-call argument deltas can create a large number of persisted stream chunks, especially for tools with large JSON inputs. Consumers that only need final tool input and tool results can opt out of persisting the intermediate argument deltas without using non-serializable stream transforms.

The option defaults to false, so existing behavior is unchanged.

How did you test your changes?

Added tests covering both behaviors:

  • doStreamStep suppresses tool-input-delta chunks when suppressToolInputDeltas: true
  • final tool input is still preserved in toolCalls and step.toolCalls
  • tool-input-delta chunks still stream by default
  • DurableAgent.stream() passes suppressToolInputDeltas through to streamTextIterator

Commands run:

pnpm --filter @workflow/ai exec vitest run src/agent/do-stream-step.test.ts src/agent/durable-agent-suppress-tool-input-deltas.test.ts -t "suppressToolInputDeltas|tool input deltas|malformed JSON"
pnpm --filter @workflow/ai build

Earlier before rebasing onto latest upstream, also ran:

pnpm --filter @workflow/ai test
pnpm exec biome check packages/ai/src/agent/durable-agent-suppress-tool-input-deltas.test.ts packages/ai/src/agent/durable-agent.test.ts packages/ai/src/agent/do-stream-step.ts packages/ai/src/agent/stream-text-iterator.ts packages/ai/src/agent/durable-agent.ts .changeset/quiet-tools-stream.md

Note: the targeted Biome check exits successfully, but the touched existing files already contain complexity/non-null/literal-key warnings unrelated to this change.

PR Checklist - Required to merge

  • 📦 pnpm changeset was run to create a changelog for this PR
  • 🔒 DCO sign-off passes (run git commit --signoff on your commits)

Signed-off-by: zz <craze3@gmail.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 2, 2026

🦋 Changeset detected

Latest commit: d3edf87

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@workflow/ai Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 2, 2026

@craze3 is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant